package one;

import java.io.FileInputStream;

import jxl.Sheet;
import jxl.Workbook;

import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;

@SuppressWarnings("deprecation")
public class RS_3 extends SeleneseTestCase {
	public SeleniumServer rs;
	@Before
	public void setUp() throws Exception {
		rs=new SeleniumServer();
		rs.start();
		selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.rightstart.com/");
		
		selenium.start();
	}



	@Test
	public void testUntitled() throws Exception {
		selenium.open("/");
		selenium.windowMaximize();
		selenium.click("link=Sign In");
		selenium.waitForPageToLoad("60000");
		for (int second = 0;; second++) {
			if (second >= 60) fail("timeout");
			try { if (selenium.isElementPresent("link=Email Signup"))
				break; } catch (Exception e) {};}
		FileInputStream fis=new FileInputStream("C:\\Users\\sirisha\\AppData\\Local\\Microsoft\\Outlook\\Outlook1\\RC_3result.xls");
		Workbook wb=Workbook.getWorkbook(fis);
		Sheet s=wb.getSheet(0);
		selenium.type("id=email",s.getCell(0,1).getContents());
		selenium.type("id=pass",s.getCell(1,1).getContents());
		selenium.click("id=send2");
		selenium.waitForPageToLoad("60000");
	
		Thread.sleep(5000);
		
	}

	@After
	public void tearDown() throws Exception {
		selenium.stop();
		rs.stop();
	}
}

